package com.mbyte.easy.admin.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.baomidou.mybatisplus.extension.service.IService;
import com.mbyte.easy.admin.entity.Allot;
import com.mbyte.easy.admin.entity.Draft;
import com.mbyte.easy.admin.entity.Group;
import com.mbyte.easy.security.entity.SysUser;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author lp
 * @since 2019-12-12
 */
public interface IDraftService extends IService<Draft> {


    IPage<Draft> pageList(IPage<Draft> page, QueryWrapper<Draft> queryWrapper);

    /**
     * 牛英健
     * @param IPage<Draft>
     * 分页连表查询（查找分组名称和被分配人）
     */
    IPage<Draft> listPage(@Param("page")IPage<Draft> page, QueryWrapper<Draft> queryWrapper);


    void insert2Id(Draft draft);

    List<Draft> queryByText(String text);

    /**
     * @Description 写手新建文章
     * @param draft
     * @Author myr
     * @return
     **/
    boolean newDraft(Draft draft, String action);

    boolean update(Draft draft);

    boolean deleteByIds(List<Long> idList);

    /**
     * 查询登陆写手用户的稿件列表
     * @Author myr
     * @param pageNo
     * @param pageSize
     * @return
     */
    IPage index(boolean isCheck,boolean isBox, Integer pageNo, Integer pageSize, Draft draft,String createTimeSpace,Boolean box);

    IPage indexVideo(boolean isCheck,boolean isBox, Integer pageNo, Integer pageSize, Draft draft,String createTimeSpace,Boolean box);

    /**
     * 查询需要检查的伙伴的稿件列表
     * @Author myr
     * @param pageNo
     * @param pageSize
     * @return
     */
    IPage partnerIndex(Integer pageNo, Integer pageSize,Draft draft,String createTimeSpace);

    IPage partnerVideoIndex(Integer pageNo, Integer pageSize,Draft draft,String createTimeSpace);

    /**
     * 版块负责人查询需要检查的下属稿件列表
     * @Author myr
     * @param pageNo
     * @param pageSize
     * @param draft
     * @return
     */
    IPage blockIndex(Integer pageNo, Integer pageSize,Draft draft,String createTimeSpace);
    IPage disallow(Integer pageNo, Integer pageSize,Draft draft,String createTimeSpace);
    IPage blockVideoIndex(Integer pageNo, Integer pageSize,Draft draft,String createTimeSpace);

    /**
     * @Description 稿件校对人查询需要检查的稿件列表
     * @Author myr
     * @Date 15:56 2019/12/11
     * @param pageNo
     * @param pageSize
     * @param draft
     * @return
     **/
    IPage draftCheckerIndex(Integer pageNo, Integer pageSize,Draft draft,String createTimeSpace);

    /**
     * @Description 稿件校对组长审核首页
     * @param allot
     * @param pageNo
     * @param pageSize
     * @Author myr
     * @return
     **/
    IPage leaderCheckIndex(Draft allot, Integer pageNo, Integer pageSize);

    /**
     * @Description //稿件终审人审核首页
     * @Author myr
     * @return
     **/
    IPage finalCheckIndex(Draft draft, Integer pageNo, Integer pageSize,String createTimeSpace);

    /**
     * @Description //稿件终审人审核首页成功
     * @Author myr
     * @return
     **/
    IPage finalCheckIndexSuccess(Draft draft, Integer pageNo, Integer pageSize);

    /**
     * @Description //稿件终审人审核失败
     * @Author myr
     * @return
     **/
    IPage finalCheckIndexFalse(Draft draft, Integer pageNo, Integer pageSize);

    /**
     * @Description 伙伴互查通过审核
     * @Author myr
     * @param draftId
     * @return
     */
    boolean partnerPass(Long draftId);

    /**
     * @Description 互查伙伴驳回
     * @param draftId
     * @Author myr
     * @return
     **/
    boolean partnerDisallow(Long draftId, String disAllowdReason);

    /**
     * @Description 版块负责人通过审核
     * @Author myr
     * @param draftId
     * @return
     */
    boolean blockLeaderPass(Long draftId);

    /**
     * @Description 版块负责人驳回
     * @param draftId
     * @Author myr
     * @return
     **/
    boolean blockLeaderDisallow(Long draftId, String disAllowdReason);

    /**
     * @Description 稿件校对人通过审核
     * @param draftId
     * @Author myr
     * @return
     **/
    boolean checkerPass(Long draftId);

    /**
     * @Description 稿件校对人驳回
     * @param draftId
     * @Author myr
     * @return
     **/
    public boolean checkerDisallow(Long draftId, String disAllowdReason);

    /**
     * @Description 稿件校对组长抽查通过
     * @param draftGroup
     * @Author myr
     * @return
     **/
    boolean leaderCheckerPass(Long draftGroup);

    /**
     * @Description 稿件校对组长抽查驳回
     * @param draftId
     * @Author myr
     * @return
     **/
    public boolean leaderCheckDisallow(Long draftId, String disAllowdReason);

    /**
     * @Description 稿件终审人抽查通过
     * @param draftGroup
     * @Author myr
     * @return
     **/
    boolean finalCheckPass(String draftGroup);

    /**
     * @Description 稿件终审人抽查驳回
     * @param draftId
     * @Author myr
     * @return
     **/
    boolean finalCheckDisallow(Long draftId,String disAllowdReason);

    /**
     * @Description 稿件审核驳回工具类
     * @param draftId
     * @Author myr
     * @return
     **/
    boolean disallowUtil(Long draftId,String disAllowdReason,Draft draft);

    /**
     * @Description 稿件审核通过工具类
     * 稿件校对人保存更改
     * @param draftId
     * @Author myr
     * @return
     **/
    boolean passUtil(Long draftId,Draft draftPre);


    /**
     * @Description //稿件驳回列表首页
     * @Author myr
     * @return
     **/
    IPage disallowIndex(Draft draft, Integer pageNo, Integer pageSize,String createTimeSpace);

    IPage disallowVideoIndex(Draft draft, Integer pageNo, Integer pageSize,String createTimeSpace);


    /**
     * @Description //稿件驳回列表首页
     * @Author myr
     * @return
     **/
    IPage disallow(Draft draft, Integer pageNo, Integer pageSize,String createTimeSpace);

    IPage disallowVideo(Draft draft, Integer pageNo, Integer pageSize,String createTimeSpace);


    /**
     * @Description //稿件待审核首页
     * @Author myr
     * @return
     **/
    IPage waitCheckIndex(Draft draft, Integer pageNo, Integer pageSize,String createTimeSpace);

    IPage waitCheckVideoIndex(Draft draft, Integer pageNo, Integer pageSize,String createTimeSpace);

    /**
     * @Description 稿件类型数据回显
     * @Author myr
     * @return
     */
    Map setDraftType();

    /**
     * @Description 稿件审核状态回显
     * @Author myr
     * @return
     */
    Map setDraftCheckStatus();

    /**
     * @Description 稿件分组回显
     * @Author myr
     * @return
     */
    Map setGroupStatus();

    /**
     * @Description 稿件终审分组回显
     * @Author myr
     * @return
     */
    Map setFinalGroupStatus(Integer statusCode);

/**
 *@author 孙祺至
 *@date 2019/12/12 19:53
 */
    SysUser getUserIdByUserName(String username);
    List<Allot>getDraftByUserId(Long allotId);
    List<Allot>getDraftByAllotnoId(Long allotNoId);
    List<Long>getChildrenIdByParentId(Long allotId);
    SysUser getUserNameByUserId(Long userid);
    Integer insertToAllot(Allot allot);
    Integer insertToGroup(Group group);

    /**
     * 刘雪奇
     */
    SysUser getUserIdByUserNameAudio(String username);
    SysUser getUserNameAudioByUserId(Long userid);

    /**
     *@author 宋昱
     *@date 2019/12/9 9:35
     * 根据登录名获取被分配人id
     */
    Long getUserIdByUsernameAudio(String username);

    List<Long> getChildrenNameByChildrenIdAudio (Long parentId);

    /**
     * @Author//宋昱
     * @Description //根据userid找draftid
     * @Date 2019/12/16 10:30
     **/
    List<Long>selectDraftIdByAllot(Long allotNo_id);

    List<Long> selectDraftIdByAllotId(Long allot_id);
    List<Draft> selectDraft(Long userid);

    int getNeedCheckSize(String groupId, int... statuscodes);

    int getNeedCheckSizePpt(String groupId, boolean inFlag, int... statuscodes);

    int getNeedCheckSizeAudio(String groupId, boolean inFlag, int... statuscodes);

    int getNeedCheckSize(String groupId, boolean inFlag, int... statuscodes);

    int getNeedCheckSizeVideo(String groupId, boolean inFlag, int... statuscodes);

    long selectRoleId();

    boolean checkSix(String ids);

    IPage sevenVideo(Draft draft, Integer pageNo, Integer pageSize,String createTimeSpace);


    String getTitleById(Long draftId);

    String getFileNameById(Long draftId);

    Long getIdByUserName(String currentUsername);

    String getNameByUserId(Long allotnoId);

    IPage<Draft> listPage(Page<Draft> page, QueryWrapper<Draft> queryWrapper,Long idByUserName);

    Map<Object,Object> draftCheckIndex(Page<Draft> page,Draft allot);

}
